//
//  ShareViewController.m
//  XiangMuB
//
//  Created by lanou3g on 16/8/22.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "ShareViewController.h"
#import "UMSocial.h"
#import "UMSocialSinaSSOHandler.h"
#import "SettingViewController.h"
@interface ShareViewController ()<UMSocialUIDelegate>

@end

@implementation ShareViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    
    self.view.backgroundColor = [UIColor whiteColor];
    //如果需要分享回调，请将delegate对象设置self，并实现下面的回调方法
    
    [UMSocialData defaultData].extConfig.title = @"这么好玩的App,快来和小伙伴们分享吧!";
    //[UMSocialData defaultData].extConfig.qqData.url = @"http://baidu.com";
    [UMSocialSnsService presentSnsIconSheetView:self
                                         appKey:@"57b3dcf367e58e7ccf002006"
                                      shareText:@"这么好玩的App,快来和小伙伴们分享吧!http://umeng.com/social"
                                     shareImage:[UIImage imageNamed:@"picture"]
                                shareToSnsNames:@[UMShareToWechatSession,UMShareToWechatTimeline,UMShareToSina,UMShareToQQ,UMShareToQzone]
                                       delegate:self];
    
    
}
-(void)didFinishGetUMSocialDataInViewController:(UMSocialResponseEntity *)response
{
    //根据`responseCode`得到发送结果,如果分享成功
    if(response.responseCode == UMSResponseCodeSuccess)
    {
        //得到分享到的平台名
        NSLog(@"share to sns name is %@",[[response.data allKeys] objectAtIndex:0]);
        
        SettingViewController *set =[SettingViewController new];
        
        [self.navigationController popToViewController:set animated:YES];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
